//super涨价规则
function FindNewRetail(NEW_RETAIL, JsonSmNfRules) {
    var NewRetail = parseFloat(NEW_RETAIL);
    //第一个层级
    if (NewRetail <= JsonSmNfRules[0].RANGE_ONE) {
        if (JsonSmNfRules[0].INC_TYPE == 'P') {
            if (NewRetail * JsonSmNfRules[0].RATE_ONE >= JsonSmNfRules[0].MAXAMOUNT_ONE) {
                return NewRetail + JsonSmNfRules[0].MAXAMOUNT_ONE
            } else {
                return NewRetail + NewRetail * JsonSmNfRules[0].RATE_ONE
            }
        } else {
            return NewRetail + JsonSmNfRules[0].RATE_ONE
        }
    }
    //第二个层级
    if (JsonSmNfRules[0].RANGE_ONE < NewRetail && NewRetail <= JsonSmNfRules[0].RANGE_TWO) {
        if (JsonSmNfRules[0].INC_TYPE == 'P') {
            if (NewRetail * JsonSmNfRules[0].RATE_TWO >= JsonSmNfRules[0].MAXAMOUNT_TWO) {
                return NewRetail + JsonSmNfRules[0].MAXAMOUNT_TWO
            } else {
                return NewRetail + NewRetail * JsonSmNfRules[0].RATE_TWO
            }
        } else {
            return NewRetail + JsonSmNfRules[0].RATE_TWO
        }
    }
    //第三个层级
    if (JsonSmNfRules[0].RANGE_TWO < NewRetail && NewRetail <= JsonSmNfRules[0].RANGE_THREE) {
        if (JsonSmNfRules[0].INC_TYPE == 'P') {
            if (NewRetail * JsonSmNfRules[0].RATE_THREE >= JsonSmNfRules[0].MAXAMOUNT_THREE) {
                return NewRetail + JsonSmNfRules[0].MAXAMOUNT_THREE
            } else {
                return NewRetail + NewRetail * JsonSmNfRules[0].RATE_THREE
            }
        } else {
            return NewRetail + JsonSmNfRules[0].RATE_THREE
        }
    }
    //第四个层级
    if (JsonSmNfRules[0].RANGE_THREE < NewRetail && NewRetail <= JsonSmNfRules[0].RANGE_FOUR) {
        if (JsonSmNfRules[0].INC_TYPE == 'P') {
            if (NewRetail * JsonSmNfRules[0].RATE_FOUR >= JsonSmNfRules[0].MAXAMOUNT_FOUR) {
                return NewRetail + JsonSmNfRules[0].MAXAMOUNT_FOUR
            } else {
                return NewRetail + NewRetail * JsonSmNfRules[0].RATE_FOUR
            }
        } else {
            return NewRetail + JsonSmNfRules[0].RATE_FOUR
        }
    }
    //第五个层级
    if (JsonSmNfRules[0].RANGE_FOUR < NewRetail && NewRetail <= JsonSmNfRules[0].RANGE_FIVE) {
        if (JsonSmNfRules[0].INC_TYPE == 'P') {
            if (NewRetail * JsonSmNfRules[0].RATE_FIVE >= JsonSmNfRules[0].MAXAMOUNT_FIVE) {
                return NewRetail + JsonSmNfRules[0].MAXAMOUNT_FIVE
            } else {
                return NewRetail + NewRetail * JsonSmNfRules[0].RATE_FIVE
            }
        } else {
            return NewRetail + JsonSmNfRules[0].RATE_FIVE
        }
    }
}
function ExceptionListRetail(IN_EXCEPTION_FLAG, RETAIL, JsonSmNfRules) {
    //在例外清单中,不涨价
    if (IN_EXCEPTION_FLAG == 'Y') {
        SM_ADD_NEW_RETAIL = Math.floor(RETAIL * 10) / 10;
    }
    //不在例外清单中,涨价
    else {
        SM_ADD_NEW_RETAIL = Math.floor(FindNewRetail(RETAIL, JsonSmNfRules) * 10) / 10;
    }
    //计算出来的价格未遵循0/5/8/9原则；如为1/2/3/4则变成5，如为6/7则变为8。
    var s = SM_ADD_NEW_RETAIL + "";
    var str = s.substring(s.indexOf(".") + 1, s.indexOf(".") + 2);
    if (str == 1 || str == 2 || str == 3 || str == 4) {
        SM_ADD_NEW_RETAIL = parseInt(s.substring(0, s.indexOf("."))) + 0.5
    }
    if (str == 6 || str == 7) {
        SM_ADD_NEW_RETAIL = parseInt(s.substring(0, s.indexOf("."))) + 0.8
    }
    return isNull(SM_ADD_NEW_RETAIL) ? RETAIL : SM_ADD_NEW_RETAIL;
}
